package com.ch.forum.dao;

import com.ch.forum.model.MyBitCoinModel;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MyBitCoinMapper {

    @Select("select t.id,t.name,t.pair,t.address,t.img_url as imgUrl from t_my_bit_coin as t")
    List<MyBitCoinModel> findAll();

    @Select("select t.* from t_my_bit_coin as t where id = #{id}")
    MyBitCoinModel findOne(@Param("id")Long id);

    @Insert("insert into t_my_bit_coin(name,pair,address,img_url) values(#{name},#{pair},#{address},#{imgUrl})")
    int add(MyBitCoinModel model);

    @Update("update t_my_bit_coin set name = #{name},pair = #{pair},address = #{address},img_url = #{imgUrl} where id = #{id}")
    int update(MyBitCoinModel model);
}
